package com.axend.aerosense.room.entity;

import com.axend.aerosense.room.R;

import java.util.HashMap;
import java.util.Map;

/**
 * 房间类型枚举
 */
public enum RoomTypeEnum {

    LIVING_ROOM(1, "Living Room", R.drawable.room_icon_livingroom),
    BEDROOM(2, "Bedroom", R.drawable.room_icon_bedroom),
    BATHROOM(3, "Bathroom", R.drawable.room_icon_bathroom),
    KITCHEN(4, "Kitchen", R.drawable.room_icon_kitchen),
    OFFICE(6, "Office", R.drawable.room_icon_study),
    OTHERS(7, "Others", R.drawable.room_icon_otherroom),

    ;

    //类型（与服务器一致）
    private int type;
    //房间名字符串资源
    private String name;
    //图片资源
    private int imageRes;

    private static Map<Integer, RoomTypeEnum> map;
    static {
        map = new HashMap<>();
        for (RoomTypeEnum value : values()) {
            map.put(value.type, value);
        }
    }

    RoomTypeEnum(int type, String name, int imageRes) {
        this.type = type;
        this.name = name;
        this.imageRes = imageRes;
    }

    public int getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public int getImageRes() {
        return imageRes;
    }

    public static RoomTypeEnum get(int type){
        return map.get(type);
    }
}
